<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //默认值 不定义的话就是undefind
        function xj(a = 0, b = 0) {
            console.log(a + b);

        }
        xj(10, 20)
        function zongfen(arr = [90, 80, 70, 60]) {
            let sum = 0;
            for (let i = 0; i < arr.length; i++) {
                sum += arr[i]
            }
            console.log(sum);

        }
        zongfen([900, 800, 700, 600])
        //返回值 return 数据；return 20
        function fn() {
            return 20
        }
        console.log(fn());
        function fh(a, b) {
            if (a > b) {
                return a
            } else {
                return b
            }
        }

        function op(arr1 = [10, 20, 887, 776]) {
            let max = arr1[0]
            let min = arr1[0]
            for (let x = 0; x < arr1.length; x++) {
                if (arr1[x] > max) {
                    max = arr1[x];
                    console.log(max);

                } for (let x = 0; x < arr1.length; x++) {
                    if (arr1[x] < min) {
                        max = arr1[x];
                        console.log(min);
                    }
                }
            }


        }
        return [max, min]





    </script>
</body>

</html>